package com.gyg.controller;

import com.gyg.returns.RespEntity;
import com.gyg.returns.RespTable;
import com.gyg.service.CloudDocumentService;
import com.gyg.vo.param.BanParam;
import com.gyg.vo.param.FileParam;
import com.gyg.vo.result.DocumentResult;
import com.gyg.vo.result.PictureResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 文档信息表 前端控制器
 * </p>
 *
 * @author gyg
 * @since 2021-04-14
 */
@RestController
@RequestMapping("/cloud-document")
@Api(value = "文档模块", tags = "文档模块")
@Slf4j
public class CloudDocumentController {

    @Resource
    private CloudDocumentService cloudDocumentService;

    @GetMapping("/list")
    @ApiOperation(value = "文档列表")
    public RespTable<List<DocumentResult>> pictureList(FileParam fileParam) {
        RespTable<List<DocumentResult>> respTable = cloudDocumentService.documentList(fileParam);
        return respTable;
    }

    @PutMapping("/ban")
    @ApiOperation(value = "封禁文档")
    public RespEntity banDocument(@RequestBody BanParam banParam) {
        RespEntity respEntity = cloudDocumentService.banDocument(banParam);
        return respEntity;
    }

    @PutMapping("/unseal")
    @ApiOperation(value = "解封文档")
    public RespEntity unsealDocument(@RequestBody BanParam banParam) {
        RespEntity respEntity = cloudDocumentService.unsealDocument(banParam);
        return respEntity;
    }

}
